﻿<%@ Page Language="C#" MasterPageFile="~/Manager.master" AutoEventWireup="true" CodeFile="AddMenuD.aspx.cs"
    Inherits="Manager_Menu_AddMenuD" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr>
            <td align="left">
                <table border="1" bordercolor="#407db3" cellpadding="2" cellspacing="2" class="tbl_Comon-Search"
                    style="border-collapse: collapse" width="100%">
                    <tr>
                        <td align="center" colspan="1" rowspan="1" valign="top" nowrap="nowrap" style="width: 10%">
                            <asp:Button ID="btnReturn" runat="server" CssClass="cssButton" Text="Quay lại" OnClick="btnReturn_Click" />
                            <asp:Button ID="btnSearch" runat="server" CssClass="cssButton" OnClick="btnSearch_Click1"
                                Text="Tìm kiếm" /></td>
                        <td class="td_Title" nowrap="nowrap" style="width: 77px">
                            <asp:Label ID="Label3" runat="server" CssClass="lbl_Common-Search" Text="Tên Menu"></asp:Label></td>
                        <td class="td_Control" nowrap="nowrap" style="width: 80%;">
                            <asp:TextBox ID="txtTenChuDe" runat="server" Width="98%"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" colspan="8" rowspan="1" valign="top">
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <tr>
                        <td align="right">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Button ID="btnSave" runat="server" CssClass="cssButton" Text="Bảo lưu" OnClick="btnSave_Click"
                                Visible="false" /></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <asp:MultiView ID="MultiView1" runat="server">
                    <asp:View ID="View1" runat="server">
                        <table border="0" cellpadding="2" cellspacing="2" class="tbl_Comon-Search" style="width: 100%;">
                            <tr>
                                <td class="td_Title" style="background-color: #00ccff">
                                    <asp:Label ID="lblDisplay" runat="server"></asp:Label>
                                    &nbsp; &nbsp;&nbsp;
                                    <asp:Label ID="lblViewUser" runat="server" Visible="False"></asp:Label></td>
                            </tr>
                            <tr>
                                <td>
                                    <table border="0" cellpadding="2" cellspacing="2" class="tbl_Comon-Search" style="width: 100%">
                                        <tr>
                                            <td class="td_Title" style="text-align: right" align="right">
                                                <asp:Label ID="lblGroupMn" runat="server" ForeColor="green" Font-Bold="true" Font-Size="14px"></asp:Label></td>
                                            <td class="td_Title" style="width: 5%; white-space: nowrap">
                                                <asp:CheckBox ID="chkAllShowMK" runat="server" onclick="fnStateGroup(this)" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
                                                <asp:Panel ID="divMaster" runat="server">
                                                    <asp:GridView ID="grv_Master" runat="server" AutoGenerateColumns="False" DataKeyNames="menuID"
                                                        Width="100%" CellPadding="2" BorderColor="#407db3" OnRowDataBound="grv_Master_RowDataBound">
                                                        <Columns>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    Tên Menu
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("MenuName") %>'></asp:Label>
                                                                    <asp:Label ID="lblMenuID" runat="server" Text='<%# Eval("MenuID") %>' Visible="false"></asp:Label>
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Left" VerticalAlign="Middle" />
                                                                <HeaderStyle CssClass="cssBorderGrv" HorizontalAlign="Left" VerticalAlign="Middle" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    <asp:Label ID="Label1" runat="server" Text="Show"></asp:Label>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkShowMK" runat="server" />
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" />
                                                                <HeaderStyle CssClass="cssBorderGrv" VerticalAlign="Middle" HorizontalAlign="Center"
                                                                    Width="40px" Wrap="false" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    <asp:Label ID="Label2" runat="server" Text="Add"></asp:Label>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkAddMK" runat="server" />
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" />
                                                                <HeaderStyle CssClass="cssBorderGrv" VerticalAlign="Middle" Width="40px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    <asp:Label ID="Label3" runat="server" Text="Update"></asp:Label>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkUpdMK" runat="server" />
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" />
                                                                <HeaderStyle CssClass="cssBorderGrv" VerticalAlign="Middle" Width="40px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    <asp:Label ID="Label4" runat="server" Text="Delete"></asp:Label>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkDelMK" runat="server" />
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" />
                                                                <HeaderStyle CssClass="cssBorderGrv" VerticalAlign="Middle" Width="40px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField>
                                                                <HeaderTemplate>
                                                                    <asp:Label ID="Label5" runat="server" Text="Sign"></asp:Label>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkSignMK" runat="server" />
                                                                </ItemTemplate>
                                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" />
                                                                <HeaderStyle CssClass="cssBorderGrv" VerticalAlign="Middle" Width="40px" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle CssClass="gvRowStyle" />
                                                        <AlternatingRowStyle CssClass="gvAlternatingRowStyle" />
                                                        <HeaderStyle CssClass="gvHeader" VerticalAlign="Middle" Wrap="false" Height="20px" />
                                                    </asp:GridView>
                                                </asp:Panel>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </asp:View>
                    <asp:View ID="View2" runat="server">
                        <table border="1" cellpadding="2" cellspacing="2" class="tbl_Comon-Search" style="width: 100%">
                            <tr>
                                <td class="td_Title" style="background-color: #33ccff">
                                    <asp:Label ID="lblDisplay1" runat="server"></asp:Label>
                                    &nbsp; &nbsp;&nbsp;
                                    <asp:Label ID="lblViewUser1" runat="server" Visible="False"></asp:Label></td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:GridView ID="grv_MasterGroup" runat="server" Width="100%" BorderColor="#407db3"
                                        CellPadding="2" DataKeyNames="menuID" AutoGenerateColumns="False" OnRowDataBound="grv_MasterGroup_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    Tên Menu
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblMndName" runat="server" Text='<%# Eval("MenuName") %>' ForeColor="green"></asp:Label>
                                                    <asp:Label ID="lblMenuID" runat="server" Text='<%# Eval("MenuID") %>' Visible="false"></asp:Label>
                                                </ItemTemplate>
                                                <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Left" Width="95%" VerticalAlign="Middle" />
                                                <HeaderStyle CssClass="cssBorderGrv" HorizontalAlign="Left" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <RowStyle CssClass="gvRowStyle" />
                                        <AlternatingRowStyle CssClass="gvAlternatingRowStyle" />
                                        <HeaderStyle CssClass="gvHeader" VerticalAlign="Middle" Wrap="false" />
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                        <br />
                        &nbsp;</asp:View>
                </asp:MultiView>
                &nbsp;
            </td>
        </tr>
    </table>

    <script language="javascript" type="text/javascript">
function fnCheckAll(obj,indexCol)
{
    var grv_Master=document.getElementById("<%= grv_Master.ClientID %>");
    if(obj.checked==true)
    {
        for(var i=0;i<grv_Master.rows.length;i++)
        {
           grv_Master.rows[i].cells[indexCol].childNodes[0].checked=true;
        }
    }
    else
    {
        for(var i=0;i<grv_Master.rows.length;i++)
        {
           grv_Master.rows[i].cells[indexCol].childNodes[0].checked=false;
        }
    }
        
}
function fnShowChildMn(obj,url,menuid)
{ 
    var CodeID='<%= Request.QueryString["CodeID"]%>';
    if(obj.checked==true)
    {       
        window.location.href="AddMenuD.aspx?Show_MK=Y&CodeID="+CodeID+"&MenuID="+menuid+"&"+ url;
    }
    else
    {
        window.location.href="AddMenuD.aspx?Show_MK=N&CodeID="+CodeID+"&MenuID="+menuid+"&"+ url;
    }
}
/*function fnStateGroup(obj)
{
    

    if(obj.checked==true)
    {
 
         divMaster.removeAttribute("disabled");
         divMaster.disabled=false; 
    }
    else
    {

        divMaster.disabled=true; 
    }
 
}
*/
function fnStateGroup(obj) 
{
    var divMaster=document.getElementById("<%= divMaster.ClientID%>");
    toggleDisabled(divMaster);
}
function toggleDisabled(el) 
{
    try 
    {
         el.disabled = el.disabled ? false : true;
    }
    catch(E)
    {
    }
        if (el.childNodes && el.childNodes.length > 0) 
        {
        for (var x = 0; x < el.childNodes.length; x++) {
        toggleDisabled(el.childNodes[x]);
        }
    }
}
    </script>

</asp:Content>
